//x分钟后巡逻队 50%概率

sleep 1500;

private _end = false;
while{!_end}do
{
	sleep 300;
	if(random 100 < 50) then
	{
	
		private _player = objNull;
		waitUntil{sleep 0.1;_player = call fn_getLivePlayer;!isNull _player};
		
		
		
		//取得最近的城市
		private _location = nearestLocation [_player, "NameCity"];
		private _pos = [locationPosition _location] call fn_getPosNearRoad;
		
		if([_pos, 1000] call fn_checkPosNearPlayer) then
		{
			private _group = [_pos, call fn_aiNum * 4 , asu_patrol] call fn_createGroup3;
			if(!isNull _group) then
			{
				//清障碍物
				[_pos, 50] call fn_cleanupTerrain;
				//额外载具
				sleep 20;
				if(random 100 < 50) then
				{
					[selectRandom asu_patrol_veh_tank, [_pos] call fn_getPosNearRoad, _group, false] call fn_createVehGroup;sleep 3;
				}else
				{
					[selectRandom asu_patrol_veh_apc, [_pos] call fn_getPosNearRoad, _group, false] call fn_createVehGroup;sleep 3;
					[selectRandom asu_patrol_veh_apc, [_pos] call fn_getPosNearRoad, _group, false] call fn_createVehGroup;sleep 3;
				};
				
				[selectRandom asu_patrol_veh_light, [_pos] call fn_getPosNearRoad, _group, false] call fn_createVehGroup;sleep 3;
				[selectRandom asu_patrol_veh_light, [_pos] call fn_getPosNearRoad, _group, false] call fn_createVehGroup;sleep 3;
				[selectRandom asu_patrol_veh_res, [_pos] call fn_getPosNearRoad, _group, false] call fn_createVehGroup;sleep 3;
				[selectRandom asu_patrol_veh_res, [_pos] call fn_getPosNearRoad, _group, false] call fn_createVehGroup;sleep 3;
				[selectRandom asu_patrol_veh_trans, [_pos] call fn_getPosNearRoad, _group, false] call fn_createVehGroup;sleep 3;
				//
				//_group addGroupIcon ["b_recon",[0,0]];
				//_group setGroupIconParams [[0,0,1,1],"巡逻队",1,true];	
				
				private _make = createMarker ["patrol", _pos];
				_make setMarkerType "flag_USA";
				//_make setMarkerSize [.8,.8];
				//_make setMarkerText "巡逻队";
				//_make setMarkerColor "ColorBlue";
				[_group, _make]spawn
				{
					params["_group", "_make"];
					while{true} do
					{
						if(isNull _group || {count _group == 0}) exitWith{deleteMarker _make};
						_make setMarkerPos (getPos _leader);
						Sleep 20;
					};
				};
				
				
				[east, "联络员", "我们使用间谍卫星发现了敌人的一支强大巡逻队，看起来人数众多，我将一直给你发送它的位置，你们最好选择绕开！"] remoteExec ["fn_talk", east];
				
				_group enableDynamicSimulation false;
				//_____________________________不被清理标记_____________________________
				_group setVariable["no_cleanup", true];
				
				[_group] spawn fn_controlPatrol;
				_end = true;
			};
		};
	};
};